import request from '@/utils/request'

// 查询学习资源列表
export function listResources(query) {
  return request({
    url: '/business/resources/list',
    method: 'get',
    params: query
  })
}

// 查询学习资源所有列表
export function listAllResources(query) {
  return request({
    url: '/business/resources/listAll',
    method: 'get',
    params: query
  })
}

// 查询学习资源详细
export function getResources(id) {
  return request({
    url: '/business/resources/getInfo/' + id,
    method: 'get'
  })
}

// 新增学习资源
export function addResources(data) {
  return request({
    url: '/business/resources/add',
    method: 'post',
    data: data
  })
}

// 修改学习资源
export function updateResources(data) {
  return request({
    url: '/business/resources/edit',
    method: 'post',
    data: data
  })
}

// 删除学习资源
export function delResources(id) {
  return request({
    url: '/business/resources/remove/' + id,
    method: 'get'
  })
}
// 下载附件
export function downLoadFile(id){
  return request({
    url: '/business/resources/downLoadFile/' + id,
    responseType: 'blob',
    method: 'get'
  })
}

// 根据文件id获取文件流
export function getBlobByFileId(id){
  return request({
    url: '/business/resources/getBlobByFileId/' + id,
    responseType: 'blob',
    method: 'get'
  })
}
